const state = {
  menus: [], // 菜单
  isCollapse: false // 菜单是否折叠
}

const mutations = {
  SET_MENUS: (state, menus) => {
    state.menus = menus
  },
  SET_MENUS_ISCOLLAPSE: (state, isCollapse) => {
    state.isCollapse = isCollapse
  }
}

const actions = {
  setMenus({ commit }, menus) {
    return new Promise(resolve => {
      commit('SET_MENUS', menus)
      resolve()
    })
  }
  // setMenusIsCollapse({ commit }, isCollapse) {
  //   return new Promise(resolve => {
  //     commit('SET_MENUS_ISCOLLAPSE', isCollapse)
  //     resolve()
  //   })
  // }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
